package com.catmai.pssmanager.service.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Vector;

import com.catmai.pssmanager.dao.StoreAreaDao;
import com.catmai.pssmanager.dao.impl.StoreAreaDaoImpl;
import com.catmai.pssmanager.po.Storearea;
import com.catmai.pssmanager.service.StoreAreaService;

public class StoreAreaServiceImpl implements StoreAreaService{
	
	private StoreAreaDao storeareadao = new StoreAreaDaoImpl();
	
	@Override
	public Vector<Vector> findAll() throws SQLException {
		List<Storearea> list = storeareadao.findAll();
		Vector<Vector> rows = new Vector<>();
		if(!list.isEmpty()) {
			Vector temp = new Vector<>();
			for (Storearea obj : list) {
				temp.add(obj.getStorearea_Id());
				temp.add(obj.getStore_Area());
				temp.add(obj.getStore_House_Id());
			}
			rows.add(temp);
		}
		return rows;
	}

	@Override
	public void saveObject(Storearea storearea) throws SQLException {
		storeareadao.saveObject(storearea);
	}

	@Override
	public void deleteObject(Integer storeareaID) throws SQLException {
		storeareadao.deleteObject(storeareaID);
	}

	@Override
	public void updateObject(Storearea storearea) throws SQLException {
		storeareadao.updateObject(storearea);
	}

	@Override
	public List<Storearea> getStoreArea(Integer storeHouseId) throws SQLException {
		return storeareadao.getStoreArea(storeHouseId);
	}

}
